How to initialize static const char array for ASCII codes [C++]
Posted
by
Janney
on Stack Overflow
See other posts from Stack Overflow
or by Janney
Published on 2011-02-11T07:10:12Z
Indexed on
2011/02/11
7:25 UTC
Read the original article
Hit count: 119
I want to initialize a static const char array with ASCII codes in a constructor, here's my code:
class Card
{
public:
Suit(void)
{
static const char *Suit[4] = {0x03, 0x04, 0x05, 0x06}; // here's the problem
static const string *Rank[ 13 ] = {'A', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K'}; // and here.
}
However i got a whole lot of errors stating that
'initializing' : cannot convert from 'char' to 'const std::string *'
'initializing' : cannot convert from 'int' to 'const std::string *'
please help me! Thank you so much.
© Stack Overflow or respective owner